home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Full / Paragon Drive Backup 9 / DB90_SE_x32.msi / Data1.cab / _EB6831515414477BBAEF30FB7430E804 < prev    next >
Text File  |  2004-02-07  |  13KB  |  582 lines

  1. //    WebHelp 5.10.005
  2. var gaProj=new Array();
  3. var gnChecked=0;
  4. var gsProjName="";
  5. var gbReady=false;
  6. var goMan=null;
  7. var gbXML=false;
  8. var gsFirstPane="";
  9. var gServerEnabled=false;
  10. var gsPath="";
  11. var gbWhPHost=false;
  12. var goDiv = null;
  13. var gsHTML = "";
  14.  
  15. if (navigator.currentNavPen)
  16.     gsFirstPane = navigator.currentNavPen;
  17.  
  18.  
  19. function delayLoad()
  20. {
  21.     if (goDiv&&gsHTML)
  22.     {
  23.         goDiv.innerHTML=gsHTML;
  24.         goDiv=null;
  25.         gsHTML="";
  26.     }
  27. }
  28.  
  29. function whCom(sName,sComFile)
  30. {
  31.     this.msName=sName;
  32.     this.msDivId=sName+"Div";
  33.     this.msIFrameId=sName+"IFrame";
  34.     this.msComFile=sComFile;
  35.     this.mbloaded=false;
  36.     this.mbShow=false;
  37.     this.show=function(bShow)
  38.     {
  39.         if(this.mbShow!=bShow)
  40.         {
  41.             if(bShow&&!this.mbloaded)
  42.             {
  43.                 this.load();
  44.             }
  45.  
  46.             var oDiv=getElement(this.msDivId);
  47.             if(oDiv)
  48.             {
  49.                 if(gbIE55||(gbIE5&&gbMac))
  50.                 {
  51.                     var oIframe=getElement(this.msIFrameId);
  52.                     if(oIframe)
  53.                     {
  54.                         if(bShow)
  55.                         {
  56.                             oDiv.style.zIndex=3;
  57.                             if(oIframe!=null)
  58.                             {
  59.                                 oIframe.style.zIndex=3;
  60.                                 if (!gbIE55)
  61.                                     oIframe.style.visibility="visible";
  62.                             }
  63.                         }
  64.                         else
  65.                         {
  66.                             oDiv.style.zIndex=2;
  67.                             if(oIframe!=null)
  68.                             {
  69.                                 oIframe.style.zIndex=2;
  70.                                 if (!gbIE55)
  71.                                     oIframe.style.visibility="hidden";
  72.                             }
  73.                         }
  74.                     }
  75.                 }
  76.                 if (!gbIE55)
  77.                     oDiv.style.visibility=(bShow==true)?'visible':'hidden';
  78.                 this.mbShow=bShow;
  79.             }
  80.  
  81.         }
  82.     }
  83.     this.load=function()
  84.     {
  85.         if(!this.mbloaded)
  86.         {
  87.             if(this.msComFile.length>0){
  88.                 var strFile= _getFullPath(getPath(), this.msComFile);
  89.                 var oDiv=getElement(this.msDivId);
  90.                 if(oDiv){
  91.                     if(gbIE4||gbOpera7){
  92.                         var nIFrameHeight=oDiv.style.pixelHeight;
  93.                         var nIFrameWidth=oDiv.style.pixelWidth;
  94.                         var sHTML="<IFRAME ID="+this.msIFrameId+" title=\"" + this.msName + "\" SRC=\""+strFile+"\" BORDER=0 FRAMEBORDER=no STYLE=\"width:";
  95.                         if(gbMac){
  96.                             sHTML+=nIFrameWidth+"px;height:"+nIFrameHeight+"px;\"></IFRAME>";
  97.                         }else{
  98.                             sHTML+="100%; height:100%;\"></IFRAME>";
  99.                         }
  100.                         oDiv.innerHTML=sHTML;
  101.                     }else if(gbNav6){
  102.                         gsHTML="<IFRAME ID="+this.msIFrameId+" title=\"" + this.msName + "\" SRC=\""+strFile+"\" BORDER=0 FRAMEBORDER=no STYLE=\"width:100%;border:0;height:100%;\"></IFRAME>";
  103.                         goDiv = oDiv;
  104.                         setTimeout("delayLoad()", 100);
  105.                     }
  106.                     this.mbloaded=true;
  107.                 }
  108.             }
  109.         }
  110.     }
  111.     this.unload=function()
  112.     {
  113.         var oDiv=getElement(this.msDivId);
  114.         if(oDiv)
  115.             oDiv.innerHTML="";
  116.     }
  117.     this.getDivHTML=function()
  118.     {
  119.         var sHTML="";
  120.         if(gbMac&&gbIE4)
  121.             sHTML+="<DIV ID="+this.msDivId+" ALIGN=left STYLE=\"position:absolute;z-index:1;left:0;top:0;width:100%;height:100%;margin:0;padding:0;border:0;\">";
  122.         else if(gbIE5)
  123.             sHTML+="<DIV ID="+this.msDivId+" ALIGN=left STYLE=\"position:absolute;z-index:1;left:0;top:0;width:100%;height:100%;\">";
  124.         else if(gbIE4||gbWindows)
  125.             sHTML+="<DIV ID="+this.msDivId+" ALIGN=left STYLE=\"position:absolute;z-index:1;left:0;top:0;width:100%;height:100%;visibility:hidden\">";
  126.         else
  127.             sHTML+="<DIV ID="+this.msDivId+" ALIGN=left STYLE=\"position:absolute;z-index:1;left:0;top:0;width:100%;height:"+parent.height+";visibility:hidden\">";
  128.         sHTML+="</DIV>";
  129.         return sHTML;
  130.     }
  131. }  
  132.  
  133. function whComMan()
  134. {
  135.     this.sName="";
  136.     this.maCom=new Array();
  137.     this.addCom=function(sName,sComFile)
  138.     {
  139.         var owhCom=new whCom(sName,sComFile);
  140.         this.maCom[this.maCom.length]=owhCom;
  141.     }
  142.     this.init=function()
  143.     {
  144.         var sHTML="";
  145.         for(var i=0;i<this.maCom.length;i++)
  146.         {
  147.             sHTML+=this.maCom[i].getDivHTML();
  148.         }
  149.         document.body.insertAdjacentHTML("beforeEnd",sHTML);
  150.  
  151.     }
  152.     this.showById=function(nId)
  153.     {
  154.         for(var s=0;s<this.maCom.length;s++)
  155.         {
  156.             if(s!==nId)
  157.                 this.maCom[s].show(false);
  158.         }
  159.         this.maCom[nId].show(true);
  160.     }
  161.     this.show=function(sName)
  162.     {
  163.         navigator.currentNavPen = sName;
  164.         var bFound=false;
  165.         for(var i=0;i<this.maCom.length;i++)
  166.         {
  167.             if(sName==this.maCom[i].msName)
  168.             {
  169.                 bFound=true;
  170.                 break;
  171.             }
  172.         }
  173.         if(bFound)
  174.         {
  175.             this.showById(i);
  176.             this.sName=sName;
  177.         }
  178.     }
  179.     this.unload=function()
  180.     {
  181.         for(var i=0;i<this.maCom.length;i++)
  182.         {
  183.             this.maCom[i].unload();
  184.         }        
  185.     }
  186.     this.getCurrent=function()
  187.     {
  188.         return this.sName;
  189.     }
  190. }
  191.  
  192. function getPath()
  193. {
  194.     if(gsPath=="")
  195.     {
  196.         gsPath=location.href;
  197.         gsPath=_replaceSlash(gsPath);
  198.         var nPosFile=gsPath.lastIndexOf("/");
  199.         gsPath=gsPath.substring(0,nPosFile+1);
  200.     }
  201.     return gsPath;
  202. }
  203.  
  204. goMan=new whComMan();
  205. function addPane(sName,sFileName)
  206. {
  207.     var oParam=new Object();
  208.     oParam.sName=sName;
  209.     var oMsg=new whMessage(WH_MSG_GETPANE, this, 1, oParam);
  210.     if (SendMessage(oMsg))
  211.     {
  212.         if (oMsg.oParam.bEnable)
  213.             goMan.addCom(sName,sFileName);
  214.     }
  215.     else
  216.         goMan.addCom(sName,sFileName);    
  217. }
  218.  
  219. function setShowPane(sName, bForce)
  220. {
  221.     if ((gsFirstPane == "") || bForce)
  222.     {
  223.         var oMsg=new whMessage(WH_MSG_GETDEFPANE, this, 1, null);
  224.         if (SendMessage(oMsg))
  225.         {
  226.             if (oMsg.oParam)
  227.                 gsFirstPane = oMsg.oParam;
  228.             else
  229.                 gsFirstPane=sName;
  230.         }
  231.         else
  232.             gsFirstPane=sName;
  233.     }
  234. }
  235.  
  236. function window_OnLoad()
  237. {
  238.     var oMsg=new whMessage(WH_MSG_GETCMD,this,1,null);
  239.     var bHidePane=false;
  240.     if (SendMessage(oMsg))
  241.     {
  242.         if(oMsg.oParam>0)
  243.         {
  244.             if(oMsg.oParam==1)
  245.                 gsFirstPane="toc";
  246.             else if(oMsg.oParam==2)
  247.                 gsFirstPane="idx";
  248.             else if(oMsg.oParam==3)
  249.                 gsFirstPane="fts";
  250.             else if(oMsg.oParam==4)
  251.                 gsFirstPane="glo";
  252.         }
  253.         else if(oMsg.oParam==0)
  254.         {
  255.             bHidePane=true;
  256.         }
  257.     }
  258.     goMan.init();
  259.     if(gsProjName!="")            
  260.         loadData2(gsProjName);    
  261.     if (bHidePane)
  262.     {
  263.         gsFirstPane="";
  264.         var oMsg1=new whMessage(WH_MSG_HIDEPANE, this, 1, null)
  265.         SendMessage(oMsg1);
  266.     }
  267.     else
  268.     {
  269.         if(gsFirstPane!="")
  270.             goMan.show(gsFirstPane);
  271.         else
  272.             goMan.showById(0);
  273.     }
  274. }
  275.  
  276. function setServerEnabled()
  277. {
  278.     gServerEnabled = true;
  279. }
  280.  
  281. function loadData2(strFile)
  282. {
  283.     if(gbXML)
  284.         loadDataXML(strFile);
  285.     else
  286.         loadData(strFile);
  287. }
  288.  
  289. function addProject(bPreferXML,sXMLName,sHTMLName)
  290. {
  291.     var bLoadXML=bPreferXML;
  292.     if(!gbIE4&&!gbNav6&&!gbOpera7)
  293.         return;
  294.     if(gbIE4&&!gbIE5)
  295.         bLoadXML=false;
  296.     if (gbIE5&&!gbMac)
  297.         bLoadXML=true;
  298.     if(gbIE55||gbNav6)
  299.         bLoadXML=true;
  300.     if(gbOpera7)
  301.         bLoadXML=false;        
  302.     if(bLoadXML)
  303.         addProjectXML(sXMLName);
  304.     else
  305.         addProjectHTML(sHTMLName);
  306. }
  307.  
  308. function addProjectHTML(sName)
  309. {
  310.     gbXML=false;
  311.     gsProjName=sName;
  312. }
  313.  
  314. function addProjectXML(sName)
  315. {
  316.     gbXML=true;
  317.     gsProjName=sName;
  318. }
  319.  
  320. function window_MyBunload()
  321. {
  322.     goMan.unload();
  323.     window_BUnload();
  324. }
  325.  
  326. function putDataXML(xmlDoc,sdocPath)
  327. {
  328.     if(xmlDoc!=null)
  329.     {
  330.         var projectNode=xmlDoc.getElementsByTagName("project")[0];
  331.         if(projectNode)
  332.         {
  333.             var aRProj=new Array();
  334.             aRProj[0]=new Object();
  335.             aRProj[0].sPPath=_getPath(sdocPath);
  336.             var sLangId=projectNode.getAttribute("langid");
  337.             if(sLangId)
  338.             {
  339.                 aRProj[0].sLangId=sLangId;
  340.             }
  341.             var sDPath=projectNode.getAttribute("datapath");
  342.             if(sDPath)
  343.             {
  344.                 if(sDPath.lastIndexOf("/")!=sDPath.length-1)
  345.                     sDPath+="/";
  346.                 aRProj[0].sDPath=sDPath;
  347.             }
  348.             else
  349.                 aRProj[0].sDPath="";
  350.             aRProj[0].sToc=projectNode.getAttribute("toc");
  351.             aRProj[0].sIdx=projectNode.getAttribute("index");
  352.             aRProj[0].sFts=projectNode.getAttribute("fts");
  353.             aRProj[0].sGlo=projectNode.getAttribute("glossary");
  354.             var RmtProject=projectNode.getElementsByTagName("remote");
  355.             var nCount=1;
  356.             for (var i=0;i<RmtProject.length;i++)
  357.             {
  358.                 var sURL=RmtProject[i].getAttribute("url");
  359.                 if(sURL)
  360.                 {
  361.                     if(sURL.lastIndexOf("/")!=sURL.length-1)
  362.                         sURL+="/";
  363.                     aRProj[nCount]=new Object();
  364.                     aRProj[nCount++].sPPath=_getFullPath(aRProj[0].sPPath,sURL);
  365.                 }
  366.             }
  367.             putProjectInfo(aRProj);
  368.         }
  369.         else
  370.         {
  371.             // on Netscape 6.0 under some situation the xml file cannot be loaded.
  372.             // so we use pure html instead.
  373.             if (gnChecked == 0)
  374.                 setTimeout("redirectToList();",100);
  375.             else
  376.             {
  377.                 gnChecked++;
  378.                 setTimeout("checkRemoteProject();", 1);
  379.             }
  380.         }
  381.     }
  382. }
  383.  
  384. function onLoadXMLError()
  385. {
  386.     gnChecked++;
  387.     setTimeout("checkRemoteProject();", 1);
  388. }
  389.  
  390. function redirectToList()
  391. {
  392.     if(gbReDirectThis)
  393.         document.location=gsNavReDirect;
  394.     else
  395.         parent.document.location=gsNavReDirect;
  396. }
  397.  
  398. function putProjectInfo(aRProj)
  399. {
  400.     if(gnChecked==0||isSamePath(gaProj[gnChecked].sPPath,aRProj[0].sPPath))
  401.     {
  402.         if(gnChecked!=0)
  403.         {
  404.             if(aRProj[0].sLangId!=gaProj[0].sLangId)
  405.                 alert("The merged Help system "+aRProj[0].sPPath+" is using a different language from the master Help system, which will cause the index and full-text search functionality to be disabled in the merged Help system.");
  406.         }
  407.         gaProj[gnChecked]=aRProj[0];
  408.         for(var i=1;i<aRProj.length;i++)
  409.         {
  410.             var bFound=false;
  411.             for(var j=0;j<gaProj.length;j++)
  412.             {
  413.                 if(isSamePath(gaProj[j].sPPath,aRProj[i].sPPath))
  414.                 {
  415.                     bFound=true;
  416.                     break;
  417.                 }
  418.             }
  419.             if(!bFound)
  420.             {
  421.                 gaProj[gaProj.length]=aRProj[i];
  422.             }
  423.         }
  424.         gnChecked++;
  425.         setTimeout("checkRemoteProject();", 1);
  426.     }
  427.     else
  428.         alert("Could not load correctly, please click Refresh.");
  429. }
  430.  
  431. function isSamePath(sPath1,sPath2)
  432. {
  433.     return (sPath1.toLowerCase()==sPath2.toLowerCase());
  434. }
  435.  
  436. function checkRemoteProject()
  437. {
  438.     if(gaProj.length!=gnChecked)
  439.     {
  440.         setTimeout("cancelProj("+gnChecked+");",10000);
  441.         loadData2(gaProj[gnChecked].sPPath+gsProjName);
  442.     }
  443.     else{
  444.         var oMsg=new whMessage(WH_MSG_PROJECTREADY,this,1,null);
  445.         gbReady=true;
  446.         SendMessage(oMsg);
  447.     }
  448. }
  449.  
  450. function cancelProj(i)
  451. {
  452.     if(i==gnChecked)
  453.     {
  454.         gnChecked++;
  455.         setTimeout("checkRemoteProject();", 1);
  456.     }    
  457. }
  458.  
  459. function window_resize()
  460. {
  461.     for(var i=0;i<goMan.maCom.length;i++)
  462.     {
  463.         var oFrame=getElement(goMan.maCom[i].msIFrameId);
  464.         if(oFrame)
  465.         {
  466.             oFrame.style.height=document.body.clientHeight;
  467.             oFrame.style.width=document.body.clientWidth;
  468.         }
  469.     }
  470.     window_resize2();
  471. }
  472.  
  473. function window_resize2()
  474. {
  475.     if(document.body)
  476.     {
  477.         if(document.body.clientWidth > 1 && document.body.clientHeight>1)
  478.         {
  479.             var oMsg = new whMessage(WH_MSG_RESIZEPANE, this, 1, null);
  480.             SendMessage(oMsg);
  481.         }
  482.     }
  483. }
  484.  
  485. function window_unload()
  486. {
  487.     UnRegisterListener2(this,WH_MSG_GETPROJINFO);
  488.     UnRegisterListener2(this,WH_MSG_SHOWTOC);
  489.     UnRegisterListener2(this,WH_MSG_SHOWIDX);
  490.     UnRegisterListener2(this,WH_MSG_SHOWFTS);
  491.     UnRegisterListener2(this,WH_MSG_SHOWGLO);
  492.     UnRegisterListener2(this,WH_MSG_GETPANEINFO);
  493. }
  494.  
  495. function onSendMessage(oMsg)
  496. {
  497.     if(oMsg)
  498.     {
  499.         var nMsgId=oMsg.nMessageId;
  500.         if(nMsgId==WH_MSG_GETPROJINFO)
  501.         {
  502.             if(gbReady)
  503.             {
  504.                 var oProj=new Object();
  505.                 oProj.aProj=gaProj;
  506.                 oProj.bXML=gbXML;
  507.                 oMsg.oParam=oProj;
  508.             }
  509.             else
  510.                 return false;
  511.         }
  512.         else if(nMsgId==WH_MSG_SHOWTOC)
  513.         {
  514.             if(goMan)
  515.                 goMan.show("toc");
  516.             var onMsg=new whMessage(WH_MSG_PANEINFO, this, 1, "toc");
  517.             SendMessage(onMsg);
  518.             onMsg = new whMessage(WH_MSG_SHOWPANE, this, 1, null);
  519.             SendMessage(onMsg);
  520.         }
  521.         else if(nMsgId==WH_MSG_SHOWIDX)
  522.         {
  523.             if(goMan)
  524.                 goMan.show("idx");
  525.             var onMsg=new whMessage(WH_MSG_PANEINFO, this, 1, "idx");
  526.             SendMessage(onMsg);
  527.             onMsg = new whMessage(WH_MSG_SHOWPANE, this, 1, null);
  528.             SendMessage(onMsg);
  529.         }
  530.         else if(nMsgId==WH_MSG_SHOWFTS)
  531.         {
  532.             if(goMan)
  533.                 goMan.show("fts");
  534.             var onMsg=new whMessage(WH_MSG_PANEINFO, this, 1, "fts");
  535.             SendMessage(onMsg);
  536.             onMsg = new whMessage(WH_MSG_SHOWPANE, this, 1, null);
  537.             SendMessage(onMsg);
  538.         }
  539.         else if(nMsgId==WH_MSG_SHOWGLO)
  540.         {
  541.             if(goMan)
  542.                 goMan.show("glo");
  543.             var onMsg=new whMessage(WH_MSG_PANEINFO, this, 1, "glo");
  544.             SendMessage(onMsg);
  545.             onMsg = new whMessage(WH_MSG_SHOWPANE, this, 1, null);
  546.             SendMessage(onMsg);
  547.         }
  548.         else if(nMsgId==WH_MSG_GETPANEINFO)
  549.         {
  550.             oMsg.oParam=goMan.getCurrent();
  551.             return false;
  552.         }
  553.     }
  554.     return true;
  555. }
  556.  
  557. if(window.gbWhUtil&&window.gbWhMsg&&window.gbWhVer&&window.gbWhProxy)
  558. {
  559.     RegisterListener2(this,WH_MSG_GETPROJINFO);
  560.     RegisterListener2(this,WH_MSG_SHOWTOC);
  561.     RegisterListener2(this,WH_MSG_SHOWIDX);
  562.     RegisterListener2(this,WH_MSG_SHOWFTS);
  563.     RegisterListener2(this,WH_MSG_SHOWGLO);
  564.     RegisterListener2(this,WH_MSG_GETPANEINFO);
  565.  
  566.     if((gbMac&&gbIE4)||(gbSunOS&&gbIE5)||gbOpera7)
  567.     {
  568.         window.onresize=window_resize;
  569.     }
  570.     else if(gbIE4)
  571.     {
  572.         window.onresize=window_resize2;
  573.     }
  574.     window.onload=window_OnLoad;
  575.     window.onbeforeunload=window_MyBunload;
  576.     window.onunload=window_unload;
  577.     gbWhPHost=true;
  578. }
  579. else
  580.     document.location.reload();
  581.  
  582.